package com.xuecheng;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * ClassName: testBCryptPasswordEncoder
 * Package: com.xuecheng
 * Description:
 *
 * @Author Endeavor-ZQB
 * @Create 2023/2/15 13:24
 * @Version 1.0
 */
public class testBCryptPasswordEncoder {
    public static void main(String[] args) {
        String password = "111111";
        BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
        for (int i =0;i<10;i++){
            //每个计算出的Hash值都不一样
            String hashPass = passwordEncoder.encode(password);
            System.out.println(hashPass);
            //虽然每次计算的密码Hash值不一样但是检验是通过的
            boolean b = passwordEncoder.matches(password, hashPass);
            System.out.println(b);
        }
    }
}
